package beanstao.util.type.base;

import java.util.ArrayList;
import java.util.Collection;

import org.apache.commons.lang.StringUtils;

import beanstao.util.exception.technical.util.reflect.FailToCastObjectException;
import beanstao.util.type.Castor;

@SuppressWarnings({ "rawtypes" })
public class String2Collection extends Castor<String, Collection>
{

	@Override
	public Collection cast(String src, Class<?> toType, String... args) throws FailToCastObjectException
	{
		String[] arr = StringUtils.split(src);
		Collection<String> stringList = new ArrayList<String>(arr.length);
		for (String string : arr)
			stringList.add(string);
		return stringList;
	}

}
